package com.dc.kylin.logbackdesensitization.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

@Data
@Component
@ConfigurationProperties(prefix = "desensitization")
public class DesensitizationProperties {

    private List<DesensitizationRule> rules;
    private ConcurrentConfig concurrent = new ConcurrentConfig();

    @Data
    public static class DesensitizationRule {
        private String name;
        private String pattern;
        private String replacement;
        private Integer maxLength;
        private Boolean custom = false;
    }

    @Data
    public static class ConcurrentConfig {
        private Integer maxLogLength = 5000;
        private Long timeoutMs = 100L;
        private Integer bufferSize = 8192;
    }
}